package com.itheima.order.service.impl;

import com.itheima.order.client.UserClient;
import com.itheima.order.domain.po.Order;
import com.itheima.order.domain.po.User;
import com.itheima.order.mapper.OrderMapper;
import com.itheima.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IOrderServiceImpl implements IOrderService {
    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private UserClient userClient;

    @Override
    public String getUserById(Long id) {
        //查询订单数据
        Order order = orderMapper.getById(id);
        //查询用户数据
        User user = userClient.getById(order.getUserId());
        return order.toString() + user.toString();
    }
}
